<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>

    // 限定符  指定一个给定组件(子表达式)出现多少次  
    // {n}    匹配前面的子表达式出现n次
    // {n,}   匹配前面的子表达式出现至少n次
    // {n,m}  匹配前面的子表达式出现至少n次,至多m次

    // *      匹配前面的子表达式出现0次或多次  {0,}
    // +      匹配前面的子表达式出现1次或多次  {1,}
    // ?      匹配前面的子表达式出现0次或1次   {0,1}  


    var str = "good study , daaaaaay up";
    // var reg = /day/;
    // var reg = /da{10}y/; // daaaaaaaaaay
    // var reg = /da{2,}y/; // daay  daaay  daaaay  ..... 
    var reg = /da{2,5}y/; // daay  daaay  daaaay   daaaaay
    // console.log(reg.test(str));
    
    
    var str = "good study , 1111dayday2222 up";
    var reg = /(day){2,5}/; // dayday  daydayday  daydaydayday  daydaydaydayday
    // console.log(reg.test(str));
    
    var str = "good study , up";
    var reg = /da*y/;  // dy  day  daay  ....
    // console.log(reg.test(str));

    var str = "good study , up";
    var reg = /da+y/;  // day  daay  ....
    // console.log(reg.test(str));

    var str = "good studay , up";
    var reg = /da?y/;  // dy  day  
    console.log(reg.test(str));










</script>
</html>